# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=python-tenacity
pkgver=8.2.2
_commit=548c5d490187af6f339cbffdd0add38aecc3ecb0
pkgrel=3
pkgdesc='Retry code until it succeeeds'
arch=('any')
license=('Apache')
url='https://github.com/jd/tenacity'
depends=('python')
optdepends=('python-tornado: for Tornado coroutines support')
makedepends=('git' 'python-setuptools-scm')
checkdepends=('python-pytest' 'python-tornado' 'python-typeguard')
source=("git+https://github.com/jd/tenacity.git#commit=$_commit" "fix-tests-for-typeguard-3.patch")
sha512sums=('SKIP'
            'a57faa9ddc1dd5a78d67691f5023b723fdd3fd643c3c3389f446244962f8c410e7f1a7d34b705e1488a4ea443f7cc6b716eff5bc354a7c1ac449fc65c6c869f0')

prepare() {
  cd tenacity
  patch -Np1 -i ${srcdir}/fix-tests-for-typeguard-3.patch
}

build() {
  cd tenacity
  python setup.py build
}

check() {
  cd tenacity
  pytest
}

package() {
  cd tenacity
  python setup.py install --root="$pkgdir" --optimize=1
}
